﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyProfile.aspx.cs" Inherits="TLTuan.Home.MyProfile" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 <title>My Profile</title>
    <link href="../Style/Style1.css" rel="stylesheet" type="text/css" />
<style type="text/css">
    a
    {
        text-decoration: none;
    }
    #left
    {
        float: left;
        width: 300px;
        border-color: #CCCCCC;
        border-style: solid;
        border-width: 1px;
    }
    #right
    {
        margin-left: 5px;
        float: left;
        width: 648px;
        border-color: #CCCCCC;
        border-style: solid;
        border-width: 1px;
    }
    .Tilehead
    {
        height: 25px;
        background-color: #059;
        color: #fff;
        font-size: 18px;
        padding: 3px 0 0 5px;
        font-weight: bold;
        margin-bottom: 10px;
    }
    .boxcont {
    float: left;
    margin-bottom: 10px;
    padding: 5px;
    width: 288px;
    }
    .boxcont .cap {
        background: url("/Images/design/linenote.gif") repeat-x scroll 0 0 transparent;
        float: left;
        font-size: 11px;
        font-weight: 700;
        height: 15px;
        margin-bottom: 5px;
        width: 100%;
    }
    .boxcont .cap p {
        background: url("/Images/design/arr_cap.gif") no-repeat scroll 0 5px #FFFFFF;
        float: left;
        padding-left: 15px;
        padding-right: 5px;
        color: #0A5992;
        margin: 0 auto;
    }
        
    .listinfo {
        float: left;
        font-size: 11px;
        padding-left: 15px;
        width: 273px;
    }
    .listinfo li {
        border-bottom: 1px dotted #CCCCCC;
        float: left;
        margin-bottom: 5px;
        padding-bottom: 5px;
        list-style-type: none;
    }
    .listinfo li.end {
        border: 0 none;
    }
    .listinfo li .col1 {
        float: left;
        font-weight: 700;
        width: 105px;
    }
    .listinfo li .col2 {
        float: left;
        width: 160px;
    }
        
    .tailieu
    {
        overflow: hidden;
        border-bottom: 1px solid #222;
        margin: 2px 10px 0 10px;
    }
    .img 
    {        
        float: left;
        margin: 0 10px 0 0;
        padding: 3px;
        text-align: center;
    }
    .img img
    {
        width: 60px;
        height: 60px;
    }
    .title
    {
        margin-top:  5px;
        font-size: 17px;
        
    }
    .title a:hover
    {
        color: #059;
    }
    
    .sapo
    {
        margin-top: 3px;
        font-size: 12px;
        color: #995500;
    }
    .pagercontainer
    {
	    margin: 10px auto;
	    text-align: center;
	    width: 100%;
    }

    .pagercontainer a, #listnewsUc .pagercontainer div
    {
	    border: 1px solid #C9C9C9;
	    color: #C9C9C9;
	    display: block;
	    float: left;
	    margin: 0 5px;
	    padding: 0 5px;
	    text-decoration: none;
    }


    .pagercontainer .currentpage, #listnewsUc .pagercontainer a:hover
    {
	    background-color: #367795;
        border: 1px solid #C9C9C9;
        color: #fff !important;
    }
    #btt_edit
    {
        margin: 5px;
        float: right;
    }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table bgcolor="white" width="950" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" bgcolor="#6666FF">
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
            height="100" width="960">
            <param name="movie" value="Flash/test2.swf">
            <param name="quality" value="high">
            <embed height="100" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high"
                src="/Images/0601.TS.swf" type="application/x-shockwave-flash" width="960"></embed>
        </object>
    </td>
  </tr>
  <tr>
    <td bgcolor="#99FF00"><table width="100%" border="0" cellpadding="5" cellspacing="0">
      <tr>
        <th><a href="Default.aspx">Trang chủ</a></th>
        <th><a href="Upload.aspx">Tải tài liệu lên</a></th>
        <th><a href="">Quản trị</a></th>                
        <th style="width: 60%;"></th>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>        
            <% if (Request.QueryString["user"] == null)
               {
                   Response.Redirect("../Home/Default.aspx");
               }
               else
               {
                   TLTuan.App.AccessLayer.CDAOThanhVien dao_thanhvien = new TLTuan.App.AccessLayer.CDAOThanhVien();
                   TLTuan.App.TransferObj.CThanhVien m_thanhvien = dao_thanhvien.SelectOne(int.Parse(Request.QueryString["user"].ToString()));
                   if (m_thanhvien != null)
                   {
                %>
          <div id="warpper">
            <div id="left">
                <div class="Tilehead">Thông tin tài khoản
                </div>
            	<div class="boxcont">
	              <div class="cap">
		            <p>Profile</p>
	              </div>
	              <ul class="listinfo">
		            <li>
		              <div class="col1">Họ và tên: </div>
		              <div class="col2"><%Response.Write(m_thanhvien.TenThanhVien); %></div>
		            </li>
		            <li>
		              <div class="col1">Ngày sinh:</div>
		              <div class="col2"><%Response.Write(string.Format("{0}", m_thanhvien.NgaySinh.ToShortDateString())); %></div>
		            </li>
		            <li>
		              <div class="col1">Giới tính: </div>
		              <div class="col2"><%Response.Write(m_thanhvien.GioiTinh==true ? "Nam" : "nữ"); %></div>
		            </li>
		            <li>
		              <div class="col1">Điện thoại:</div>
		              <div class="col2"><%Response.Write(m_thanhvien.Mobile); %></div>
		            </li>		            
		            <li class="end">
		              <div class="col1">Email:</div>
		              <div class="col2"><%Response.Write(m_thanhvien.Email); %></div>
		            </li>
                  </ul>
		          <div class="cap">
		            <p>Account</p>
	              </div>
	              <ul class="listinfo">
		            <li>
		              <div class="col1">Tài khoản:</div>
		              <div class="col2"><%Response.Write(m_thanhvien.TaiKhoan); %></div>
		            </li>
                    <li>
		              <div class="col1">Ngày tham gia:</div>
		              <div class="col2"><%Response.Write(string.Format("{0}", m_thanhvien.NgayThamGia.ToShortDateString())); %></div>
		            </li>
		            <li class="end">
		              <div class="col1">Điểm:</div>
		              <div class="col2"><%Response.Write(m_thanhvien.Diem.ToString()); %></div>
		            </li>                                                                                   
		            </ul>
                    <asp:Label ID="lab_thongbao" runat="server" Visible="False" Text="Label" 
                                    ForeColor="Red"></asp:Label>
                    <asp:Button ID="btt_edit" runat="server" Text="Sửa thông tin" 
                        onclick="btt_edit_Click" />                   
	            </div>
            </div>
            <div id="right">
                <div class="Tilehead">Danh sách tài liệu đã tải lên</div>
                <%  
                    int m_i_pageNum = 1;
                    int m_i_pageNews = 5;
                    // số tin, giúp ta đánh số các trang
                    int m_i_allNews = 0;                    
                    if (Request.QueryString["Page"] != null)
                        int.TryParse(Request.QueryString["Page"].ToString(), out m_i_pageNum);
                    TLTuan.App.AccessLayer.CDAOTaiLieu dao_tailieu = new TLTuan.App.AccessLayer.CDAOTaiLieu();
                    List<TLTuan.App.TransferObj.CTaiLieu> list_tailieu = dao_tailieu.get_tailieu_byThanhvien(m_thanhvien.PK_ThanhVienID,m_i_pageNum, m_i_pageNews);
                    if (list_tailieu!=null && list_tailieu.Count > 0)
                    {
		                foreach (TLTuan.App.TransferObj.CTaiLieu itailieu in list_tailieu)
	                    {
                            Response.Write( string.Format("<div class='tailieu'><div class='img'><img src='/Images/design/tailieu.jpg' alt=''/><span class='icon'></span></div>"));
                            Response.Write( string.Format("<div class='title'><a href='./ChiTietTaiLieu.aspx?NId={0}'>{1}</a></div><div class='sapo'>{2} Điểm,  Dung lượng: {3}Kb,  Ngày đăng: {4}/{5}/{6}</div></div>",  itailieu.PK_TailieuID,
                              itailieu.TenTaiLieu, itailieu.diem, itailieu.Dungluong.ToString("0,0"), itailieu.Ngaydang.Day, itailieu.Ngaydang.Month, itailieu.Ngaydang.Year));
	                    }
                    }
                       
                    int m_i_pageCount = (m_i_allNews - 1) / m_i_pageNews + 1;
                    string v_str_html = "<div class='pagercontainer'>";
                    if (m_i_pageCount == 1)
                    {
                    }
                    else
                    {
                        if (m_i_pageNum > 1)
                        {
                            v_str_html += string.Format("<a href='./MyProfile.aspx?user={0}&Page={1}'>« Trước</a>",m_thanhvien.PK_ThanhVienID, m_i_pageNum - 1);
                        }

                        for (int i = m_i_pageNum - 1; i < m_i_pageNum + 2; i++)
                        {
                            if (i > 0 && i <= m_i_pageCount)
                            {
                                if (i != m_i_pageNum)
                                    v_str_html += string.Format("<a href='./MyProfile.aspx?user={0}&Page={1}'>{2}</a>",m_thanhvien.PK_ThanhVienID, i, i);
                                else
                                    v_str_html += string.Format("<div class='currentpage'>{0}</div>", i);
                            }
                        }

                        if (m_i_pageNum < m_i_pageCount)
                        {
                            v_str_html += string.Format("<a href='./MyProfile.aspx?user={0}&Page={1}'>Sau »</a>",m_thanhvien.PK_ThanhVienID, m_i_pageNum + 1);

                        }

                        v_str_html += "</div>";
                        Response.Write(v_str_html);
                    }
                       %>
            </div>
        </div>
                <%
                   }
                   else Response.Redirect("../Home/Default.aspx");
               }%>            
    </td>
  </tr>
  <tr>
    <td bgcolor="#CCFF00"><table border="0" align="center" cellpadding="5" cellspacing="0">
      <tr>
        <td align="center"><a href="">Home Page </a></td>
        <td align="center"><a href="">About Us </a></td>
        <td align="center"><a href="">Contact Us </a></td>
        <td align="center"><a href="">Feedback</a></td>
        <td align="center"><a href="">My Account </a></td>
        <td align="center"><a href="">Shopping Guide </a></td>
      </tr>
    </table></td>
  </tr>
</table>
    </div>
    </form>
</body>
</html>
